package com.david.IfaceAutoTest.aspect;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.sql.Date;
import java.sql.Timestamp;

/**
 * TODO
 *
 * @author david
 * @version 1.0
 * @date 2021/11/1811:19
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {

    @Bean
    public Docket userApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .enable(true)
                .apiInfo(new ApiInfoBuilder()
                        .title("Interface-Auto-Test")
                        .description("接口自动化项目接口文档")
                        .version("1.0")
                        .build())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.david.IfaceAutoTest.controller"))
                .paths(PathSelectors.any())
                .build()
                .directModelSubstitute(Timestamp.class, Date.class);
//        .directModelSubstitute(Timestamp.class, Date.class); 用于优化Timestamp 展示形式
    }
}
